class Solution {
    
    private List<List<Integer>> result = new ArrayList<>();
    private List<Integer> subSet = new ArrayList<>();

    public List<List<Integer>> subsets(int[] nums) {
        findSubSet(nums, 0);
        return result;
    }
    private void findSubSet(int[] nums, int index) {
        if (index == nums.length) {
            result.add(new ArrayList<>(subSet));
            return ;
        }
        // 对当前index，两种处理结果，一种是要，一种是不要；
        subSet.add(nums[index]);
        findSubSet(nums, index + 1);
        subSet.remove(subSet.size() - 1);

        findSubSet(nums, index + 1);
    }
}
